package com.example.blogapi.controller;

import com.example.blogapi.domain.MsSysUser;
import com.example.blogapi.service.LoginService;
import com.example.blogapi.service.MsSysUserService;
import com.example.blogapi.utils.JWTUtils;
import com.example.blogapi.vo.ErrorCode;
import com.example.blogapi.vo.Result;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;
@Api(tags = "用户接口")
@Controller
@RequestMapping("users")
public class UserController {
    @Autowired
    private MsSysUserService msSysUserService;
    @Autowired
    private LoginService loginService;
    /*swagger注解*/
    @ApiOperation(value = "查询当前用户",notes = "通过token查询当前用户")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "token",value = "通过token获取当前用户",required = true,paramType = "header",dataType = "String")
//    })
    @RequestMapping("/currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){
        return msSysUserService.findUserByToken(token);
    }
}
